<!-- src/views/user/RoleDetail.vue -->
<script setup>
import { ref, reactive } from 'vue';
import {useRoleStore} from "@/stores/roleStore.js";
const roleStore = useRoleStore();
const dialogVisible = ref(false);

const role = reactive({
  roleId: '',
  roleIds: [],
  name: '',
  code: '',
  dataScope: 1,
  aclIds: [],
  description: ''
});



const show = (roleInfo) => {
  Object.assign(role, roleInfo);
  role.roleId = roleInfo.id;
  dialogVisible.value = true;
};

const close = () => {
  dialogVisible.value = false;
};

// 对外暴露show方法
defineExpose({
  show
});
</script>

<template>
  <el-dialog
      title="角色详情"
      v-model="dialogVisible"
      width="50%"
  >
    <el-form :model="role" label-width="100px">
      <el-form-item label="角色名称">
        <el-input v-model="role.name" readonly />
      </el-form-item>
      <el-form-item label="角色编码">
        <el-input v-model="role.code" readonly />
      </el-form-item>
      <el-form-item label="数据权限范围">
        <el-select v-model="role.dataScope" disabled>
          <el-option label="全部" :value="1"></el-option>
          <el-option label="本部门" :value="2"></el-option>
          <el-option label="自定义" :value="3"></el-option>
        </el-select>
      </el-form-item>
      <el-form-item label="角色描述">
        <el-input v-model="role.description" type="textarea" readonly />
      </el-form-item>
      <el-form-item>
        <el-button @click="close">关闭</el-button>
      </el-form-item>
    </el-form>
  </el-dialog>
</template>

<style scoped>

</style>
